<?php
/**
 *
 *
 * @author Zeon <scplay@gmail.com>
 * @date 2019/5/28 14:35
 * @copyright PanxSoft Inc.
 */


use App\Http\Controllers\Admin\V1\AdminLoginController;
use App\Http\Controllers\Admin\V1\CouponTicketController;
use App\Http\Controllers\Admin\V1\DeviceController;
use App\Http\Controllers\Admin\V1\DevicePresetController;
use App\Http\Controllers\Admin\V1\ManufactureController;
use App\Http\Controllers\Admin\V1\SplashAdvertController;
use App\Http\Controllers\Admin\V1\WishListController;
use App\Http\Controllers\App\V1\BulletinBoardController;
use App\Http\Controllers\Admin\V1\UserController;
use App\Http\Controllers\Admin\V1\UserSkinRecordController;
use App\Models\Admin;
use Illuminate\Support\Facades\Route;

Route::group([
    'middleware' => ['LocaleEnv']
], function () {
    /**
     * @see AdminLoginController::login()
     */
    Route::post('/admin-login', 'AdminLoginController@login')
        ->name(AdminLoginController::ROUTES['login']);
});


Route::group(/**
 *
 */
    [
    'middleware' => ['LocaleEnv:'. Admin::GUARD_NAME , 'AdminAuth']
], function () {
    /**
     * @see DeviceController
     */
    Route::resource('/device', 'DeviceController')
        ->names(DeviceController::ROUTES);
    
    /**
     * admin获取App的用户
     */
    Route::resource('/app-user','UserController');

    /**
     * 获取用户的的所有的肤质检测记录
     */
    Route::get('/user-skin/user/{user_id}','UserSkinRecordController@index')->name('admin.v1.user-skin.user');
    /**
     * 获取指定id的测服记录
     */
    Route::get('/user-skin/records/{record_id}','UserSkinRecordController@showRecord')->name('admin.v1.user-skin.record');

    /**
     * 删除测服记录
     */
    Route::delete('/user-skin/records/delete','UserSkinRecordController@destroy')->name('admin.v1.user-skin.destroy');

    /**
     * @see ManufactureController
     */
    Route::resource('/manufacture', 'ManufactureController')
        ->names(ManufactureController::ROUTES);

    /**
     * @see DevicePresetController
     */
    Route::resource('/device-preset', 'DevicePresetController')
        ->names(DevicePresetController::ROUTES);

    /**
     * @see SplashAdvertController
     */
    Route::resource('/splash-advert', 'SplashAdvertController')
        ->names(SplashAdvertController::ROUTES);

    /**
     * @see BulletinBoardController
     */
    Route::resource('/bulletin-board', 'BulletinBoardController')
        ->names(BulletinBoardController::ROUTES);

    /**
     * @see WishListController
     */
    Route::patch('/wish-list-realize/{wish_list_id}', 'WishListController@patchRealize')
        ->name(WishListController::ROUTES['patchRealize']);

    /**
     * @see WishListController
     */
    Route::resource('/wish-list', 'WishListController')
        ->names(WishListController::ROUTES);

    /**
     * @see CouponTicketController
     */
    Route::resource('/coupon-ticket', 'CouponTicketController')
        ->names(CouponTicketController::ROUTES);
});
